package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zw.admin.server.model.PSupplierGoods;

@Mapper
public interface PSupplierGoodsDao {

    @Select("select * from p_supplier_goods t where t.id = #{id}")
    PSupplierGoods getById(Long id);

    @Delete("delete from p_supplier_goods where id = #{id}")
    int delete(Long id);

    int update(PSupplierGoods pSupplierGoods);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into p_supplier_goods(sup_item_no, item_no, supplier_no, goods_type, goods_name, least_buy_quantity, buy_unit, brand, specific, place, property, pre_buy_price, createTime, updateTime) values(#{supItemNo}, #{itemNo}, #{supplierNo}, #{goodsType}, #{goodsName}, #{leastBuyQuantity}, #{buyUnit}, #{brand}, #{specific}, #{place}, #{property}, #{preBuyPrice}, #{createTime}, #{updateTime})")
    int save(PSupplierGoods pSupplierGoods);
    
    int count(@Param("params") Map<String, Object> params);

    List<PSupplierGoods> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
